<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // 1, 将数组[1, 5, 6, 3, 2, 8, 9, 4] 降序排序
        var arr1=[1, 5, 6, 3, 2, 8, 9, 4];
        arr1.sort(function(a,b){
            return b-a;
        })
        console.log(arr1);
        console.log("------------------------");


    // 2, 请将数组[1,46,74,3,5,5]中的元素右移1位
        var arr2=[1,46,74,3,5,5];
        arr2.unshift(arr2.pop());
        console.log(arr2);
        console.log("------------------------");


    // 3, 插数:在数组[1,46,74,3,5,5]的下标为2的位置插入一个数字8，
    // 结果为[1,46,8,74,3,5,5]
        var arr3=[1,46,74,3,5,5];
        arr3.splice(2,0,8)
        console.log(arr3);
        


    </script>
</body>
</html>